#include "i2c.h"

I2CComm::I2CComm(uint8_t address) : _address(address) {}

void I2CComm::begin() {
    Wire.begin();
    Wire.setClock(I2C_FREQ);
}

void I2CComm::sendData(uint8_t* data, size_t size) {
    Wire.beginTransmission(_address);
    Wire.write(data, size);
    Wire.endTransmission(true); // 手动发送 Stop Condition
}

void I2CComm::end() {
    Wire.end();
}
